package com.atguigu.eduservice.controller;


import com.atguigu.commonutils.R;
import com.atguigu.eduservice.entity.chapter.ChapterVo;
import com.atguigu.eduservice.service.EduChapterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 课程 前端控制器
 * </p>
 *
 * @author hjt
 * @since 2021-07-02
 */
@RestController
@CrossOrigin
@RequestMapping("/eduservice/chapter")
public class EduChapterController {

    @Autowired
    private EduChapterService chapterService;

    /**
     * 获取所有的章节小节
     * @param courseId
     * @return
     */
    @GetMapping("list/{courseId}")
    public R getAllChapterVideo(@PathVariable String courseId) {

        List<ChapterVo> list = chapterService.getAllChapterVideo(courseId);
        return R.ok().data("list", list);
    }
}

